home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / print / samples.zip / BB4GS.DOC < prev    next >
Text File  |  1992-04-23  |  6KB  |  117 lines

  1.  
  2. 1. General Information
  3. ----------------------
  4.                    
  5.   BB4GS.PS is a version of Bernie Cosell's %%BoundingBox calculator
  6. (bb.ps, v1.14, part of the bbfig package) which has been specifically
  7. modified to work with Ghostscript, the PostScript interpreter written by
  8. L. Peter Deutsch and distributed by the GNU project.
  9.  
  10. [Note that a %%BoundingBox line is often extremely useful and possibly
  11. even necessary when including PostScript figures in a document being
  12. prepared with a typesetting program (such as TeX); discussing how to do
  13. this inclusion, however, is beyond the scope of this document, so it
  14. will be assumed that the reader already knows how to use this
  15. %%BoundingBox information once it is obtained.  More information can be
  16. obtained in the PostScript Language Reference Manual, for example, or in
  17. the documentation which comes with the program dvips.]
  18.  
  19.   I originally used bb.ps to calculate %%BoundingBox parameters by
  20. prepending it to a file and then sending the whole thing to a Postscript
  21. printer.  With the advent of Ghostscript, however, it was no longer
  22. necessary to waste paper, since the file could be previewed and the
  23. %%BoundingBox read directly.
  24.  
  25.   A very small number of changes have been made to bb.ps to make a
  26. version to use with Ghostscript.  (In my opinion, this says quite a bit
  27. about the quality of this PostScript interpreter.)  Nevertheless, I have
  28. changed the name to bb4gs to make sure there is no confusion with Bernie
  29. Cosell's original version.
  30.  
  31.   The detailed changes are documented in the file itself, but
  32. essentially, they:
  33.  
  34.   1) increased the default font size for easy reading on small screens
  35.      (like the PC's).
  36.  
  37.   2) stubbed out the strokepath operator, which to the best of my
  38.      knowledge is still not fully implemented in Ghostscript.
  39.  
  40.   3) added a hook so that bb4gs can tell if the %%BoundingBox is to
  41.      be displayed on the screen or sent to stdout (more later), so that
  42.      in the latter case not more than one copy is sent.
  43.  
  44.   4) (optional) replaced the show operator with print so that
  45.      Ghostscript will send the %%BoundingBox to stdout.  Currently this
  46.      is commented out in bb4gs to allow the option (or not) of
  47.      invoking this feature from the command line, but if it is decided
  48.      that bb4gs will always be used in this manner the comments can be
  49.      removed.  (My thanks to Richard Murphey <rich@rice.edu> for this
  50.      idea.)
  51.  
  52.  
  53.   In addition to the file bb4gs.ps which does all of the work, there are
  54. some additional files included with it.  They are:
  55.  
  56. bbprint.ps  - a file which can be used to replace the show operator with
  57.               print so Ghostscript send the %%BoundingBox to stdout.
  58.  
  59. bbget.bat   - a batch file to invoke Ghostscript and send the
  60.               %%BoundingBox information to the file bb.out
  61.  
  62. bbget       - a unix shell script to invoke Ghostscript to capture the
  63.               %%BoundingBox information and insert it (using sed) in the
  64.               proper place in the file.  (This script was written by
  65.               Richard Murphey <rich@rice.edu>.)
  66.  
  67. noscreen.ps - a file to stub out the setscreen operator, which can
  68.               cause `out of memory' errors (VMerror) on PCs.  Note that
  69.               use of this file doesn't always work, but it has helped on
  70.               occasion.  It is meant to be invoked on the command line
  71.               before the desired file.
  72.  
  73.  
  74. 2. Use
  75. ------
  76.  
  77.   Ghostscript accepts multiple filenames on the command line, so that
  78. the simplest way to invoke bb4gs to find the %%BoundingBox for the file
  79. example.ps is to type:
  80.  
  81.       gs bb4gs.ps example.ps
  82.  
  83. Ghostscript will first load bb4gs.ps and then run example.ps, displaying
  84. the %%BoundingBox information on the screen when a showpage command is
  85. encountered (if the file example.ps doesn't have a showpage command in
  86. it, however, then it may be necessary to type the showpage manually at
  87. the Ghostscript GS> prompt).
  88.  
  89.   The PC batch file (bbget.bat) and unix shell script (bbget) merely
  90. invoke bbprint.ps first, which redirects Ghostscript output to stdout,
  91. then bb4gs.ps, and then finally the desired file.  The batch file sends
  92. the resulting %%BoundingBox information to a file bb.out so that it can
  93. be placed manually in the PostScript file using a text editor, but the
  94. unix shell script calls sed which does the inserting automatically.  (It
  95. is possible that such automatic insertion can be accomplished on the PC,
  96. but it didn't seem worth the effort to explore this further.)
  97.  
  98.   These files have been tested on numerous versions of Ghostscript,
  99. starting with version 1.3 and up to the current version 2.4, with no
  100. problems.  (The PC versions were tested on both 286 and 386 machines,
  101. and the Unix version were tested on Sun Sparcstation 1s running SunOS
  102. 4.1.0.)  They have not, however, been tested on all possible types of
  103. *PostScript* files, since there are so many of them available.  If an
  104. example is encountered for which bb4gs *doesn't* work, an answer is
  105. probably more likely to be found by posting the problem on the USENET
  106. groups comp.lang.postscript or gnu.ghostscript.bug than by sending the
  107. file to me; I am unfortunately *not* really a PostScript expert (rather,
  108. in our department, I'm merely the best at *faking* it.)
  109.  
  110.   In any event, I hope these PostScript programs are useful.  I have
  111. certainly found them to be.
  112.  
  113.  
  114.      Bill Kath ---------------------------------- kath@nwu.edu
  115.                   Engineering Sciences and Applied Mathematics
  116.      McCormick School of Engineering,  Northwestern University
  117.